<%@ Page trace="false" EnableViewState="false" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" codefile="MatchReports.aspx.vb" Inherits="MatchReports" %>

<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="server">

    <asp:sqldatasource id="SqlDataSource1" runat="server"
        EnableCaching="true" CacheDuration="Infinite"
        selectcommand="SELECT [FixtureID], [FixtureDate], [FixtureType], [GoalsFor], [GoalsAgainst], [Notes], [Opponents] FROM [dbo].[Fixtures]"
        connectionstring="<%$ ConnectionStrings:WroxUnited %>"></asp:sqldatasource>
        
    <asp:gridview id="GridView1" runat="server" datakeynames="FixtureID" datasourceid="SqlDataSource1"
        emptydatatext="There are no data records to display." autogeneratecolumns="False"
        allowpaging="True" allowsorting="True">
        <Columns>
            <asp:CommandField ShowSelectButton="True" SelectText="More Details"></asp:CommandField>
            <asp:BoundField ReadOnly="True" HeaderText="FixtureID" DataField="FixtureID" SortExpression="FixtureID" Visible="False"></asp:BoundField>
            <asp:BoundField HeaderText="Date" DataField="FixtureDate" SortExpression="FixtureDate" DataFormatString="{0:dd-MMM-yy}"></asp:BoundField>
            <asp:BoundField HeaderText="Opponents" DataField="Opponents" SortExpression="Opponents"></asp:BoundField>
            <asp:BoundField HeaderText="Fixture Type" DataField="FixtureType" SortExpression="FixtureType"></asp:BoundField>
            <asp:BoundField HeaderText="Goals For" DataField="GoalsFor" SortExpression="GoalsFor"></asp:BoundField>
            <asp:BoundField HeaderText="Goals Against" DataField="GoalsAgainst" SortExpression="GoalsAgainst"></asp:BoundField>
        </Columns>
    </asp:gridview>

    <asp:sqldatasource id="SqlDataSource2" runat="server"
        selectcommand="SELECT [FixtureID], [Report], [MemberName] FROM [MatchReports] WHERE ([FixtureID] = @FixtureID)"
        connectionstring="<%$ ConnectionStrings:WroxUnited %>">
        <SelectParameters>
            <asp:ControlParameter Name="FixtureID" Type="Int32" ControlID="GridView1" PropertyName="SelectedValue"></asp:ControlParameter>
        </SelectParameters>
    </asp:sqldatasource>

    <p />
    <asp:repeater id="Repeater1" runat="server" datasourceid="SqlDataSource2">
        <Itemtemplate>
            <p>
            <div class="itemTitle">
                <asp:Label Text='<%# Bind("MemberName") %>' runat="server" id="Label1" />  
            </div>
            <asp:Label Text='<%# Bind("Report") %>' runat="server" id="ReportLabel" /><br />
            </p>          
        </Itemtemplate>
    </asp:repeater>

</asp:Content>
